<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<x:parse xml="${param.xmlstr}" var="xmlData" />
<div class="t_bar">
	<span class="color_red">*</span>投保情况表(单位：万元)

</div>
	<table  id="tblinsurances" cellpadding="0" class="table01 t_css" width="100%" border="0" cellpadding="0" style="*border-bottom: #a1c0dc 1px solid;">
			<thead >
					<tr style="border:1px solid #B7D1E6">
						<th class="TblHead" align="center"  width="4%">选择</th>
						<th class="TblHead" align="center"  width="4%">序号</th>
						<th class="TblHead" align="center"  width="13%">投保时间</th>
						<th class="TblHead" align="center"  width="11%">投保险种</th>
						<th class="TblHead" align="center"  width="11%">投保费率(%)</th>
						<th class="TblHead" align="center"  width="11%">保险保额</th>
						<th class="TblHead" align="center"  width="11%">实缴保费</th>
						<th class="TblHead" align="center"  width="10%">保险期限</th>
						<th class="TblHead" align="center"  width="12%">凭证（合同）号</th>
						<th class="TblHead" align="center"  width="12%">备注</th>
					</tr>
			</thead>
			<tbody id="tab" align="center">
					<tr style="display:none">
						<td>
							<input type="radio" class="radiobutton" name="selinsurances" >
						</td>
						<td align="center">
							<span name="insurances|insurance[0]@seq_no" >[index]</span> 
						</td>
						<td align="center">
							<input  id="insurance_date_[0]" name="insurances|insurance[0]|insurance_date" value="" class=" required input_text date" style="width:70px" label="投保时间" />
						</td>
						<td>
							<input type="text" id="insurances_cate_[0]" name="insurances|insurance[0]|insurance_cate" label="投保险种" value="" class="required input_css" style="width: 70px;"/>
						</td>
						<td>
							<input type="text" id="insurances_rates_[0]" name="insurances|insurance[0]|insurance_rates" onfocus="InitInput.setNumber(this,9,2,2)" label="投保费率" value="" class="required input_css" style="width: 70px; text-align: right;"/>
						</td>
						<td>
							<input type="text" id="insurances_coverage_[0]" onchange="countTotal('tblinsurances')" onfocus="InitInput.setNumber(this,9,4,2)" name="insurances|insurance[0]|insurance_coverage" label="保险保额" value="" class="required input_css" style="width: 70px; text-align: right;"/>
						</td>
						<td>
							<input type="text" id="insurances_pay_[0]" onchange="countTotal('tblinsurances')" onfocus="InitInput.setNumber(this,9,4,2)" name="insurances|insurance[0]|insurance_pay" label="保险保额" value="" class="required input_css" style="width: 70px; text-align: right;"/>
						</td>
						<td>
							<input type="text" id="insurances_funds_[0]" name="insurances|insurance[0]|insurance_funds" label="保险期限" value="" class="required input_css" style="width: 70px;"/>
						</td>
						<td>
							<input type="text" id="insurances_deadline_[0]" name="insurances|insurance[0]|insurance_deadline" label="凭证（合同）号" value="" class="required input_css" style="width: 70px;"/>
						</td>
						<td>
							<input type="text" id="insurances_remark_[0]" name="insurances|insurance[0]|insurance_remark" label="备注" value="" class="required input_css" style="width: 90px;"/>
						</td>
					</tr>
					
					
					<c:set value="0" var="index" scope="page"/>
					<x:forEach select="$xmlData/data/insurances/insurance" var="insurance">
					
					<c:choose>
						<c:when test="${index<10}" ><c:set value="0" var="flag" scope="page"/></c:when>
						<c:otherwise><c:set value="" var="flag" scope="page"/></c:otherwise>
					</c:choose>
					<tr >
						<td align="center">
							<input type="radio" class="radiobutton" name="selinsurances" >
						</td>
						<td align="center">
							<span   name="insurances/insurance[${flag}${index}]@seq_no" ><x:out select="$insurance/@seq_no"/></span> 
						</td>
						<td align="center">
							<c:set var="insurance_date" scope="page"><x:out select="$insurance/insurance_date"/></c:set>
							<input  id="insurance_date_[${flag}${index}]" value="${insurance_date}" label="投保时间" name="insurances/insurance[${flag}${index}]/insurance_date" class="required date input_text"  style="width:70px" label="投保时间" /> 
						</td>
						<td>
							<input type="text" id="insurances_cate_[${flag}${index}]" name="insurances/insurance[${flag}${index}]/insurance_cate" label="投保险种" value="<x:out select="$insurance/insurance_cate"/>" class="required input_css" style="width: 70px;"/>
						</td>
						<td>
							<input type="text" id="insurances_rates_[${flag}${index}]" name="insurances/insurance[${flag}${index}]/insurance_rates" onfocus="InitInput.setNumber(this,9,2,2)" label="投保费率" value="<x:out select="$insurance/insurance_rates"/>" class="required input_css" style="width: 70px; text-align: right;"/>
						</td>
						<td>
							<input type="text" id="insurances_coverage_[${flag}${index}]" onfocus="InitInput.setNumber(this,9,4,2)" name="insurances/insurance[${flag}${index}]/insurance_coverage" label="保险保额" value="<x:out select="$insurance/insurance_coverage"/>" class="required input_css" style="width: 70px; text-align: right;"/>
						</td>
						<td>
							<input type="text" id="insurances_pay_[${flag}${index}]" onchange="countTotal('tblinsurances')" onfocus="InitInput.setNumber(this,9,4,2)" name="insurances/insurance[${flag}${index}]/insurance_pay" label="保险保额" value="<x:out select="$insurance/insurance_pay"/>" class="required input_css" style="width: 70px; text-align: right;"/>
						</td>
						<td>
							<input type="text" id="insurances_funds_[${flag}${index}]" onchange="countTotal('tblinsurances')"  name="insurances/insurance[${flag}${index}]/insurance_funds" label="保险期限" value="<x:out select="$insurance/insurance_funds"/>" class="required input_css" style="width: 70px;"/>
						</td>
						<td>
							<input type="text" id="insurances_deadline_[${flag}${index}]" name="insurances/insurance[${flag}${index}]/insurance_deadline" label="凭证（合同）号" value="<x:out select="$insurance/insurance_deadline"/>" class="required input_css" style="width: 70px;"/>
						</td>
						<td>
							<input type="text" id="insurances_remark_[${flag}${index}]" name="insurances/insurance[${flag}${index}]/insurance_remark" label="备注" value="<x:out select="$insurance/insurance_remark"/>" class="required input_css" style="width: 90px;"/>
						</td>
					</tr>
					<c:set value="${index+1}" var="index" scope="page"/>
					</x:forEach>
					<script type="text/javascript">
						showAllDateTag("tblinsurances");
					</script>
				</tbody>
					</table>
					<table  id="tblinsurancesex" cellpadding="0" class="table01 t_css" width="100%" border="0" cellpadding="0" style="*border-bottom: #a1c0dc 1px solid;">
						<tr>
							<td class="TblHead" align="center"  width="43%">合计</td>
							<td width="11%">
								<input type="text" id="insur_total" onfocus="InitInput.setNumber(this,9,4,2)" name="insur_totals/insur_total/insur_total" label="保险保额" value="<x:out select="$xmlData/data/insur_totals/insur_total/insur_total"/>" disabled class="gray input_css" style="width: 80px; text-align: right;"/>
							</td>
							<td width="11%">
								<input type="text" id="insur_total_pay" onfocus="InitInput.setNumber(this,9,4,2)" name="insur_totals/insur_total/insur_total_pay" label="保险保额" value="<x:out select="$xmlData/data/insur_totals/insur_total/insur_total_pay"/>" disabled class="gray input_css" style="width: 80px; text-align: right;"/>
							</td>
							<td align="center" style="width: 22%">/</td>
							<td align="center" style="width: 10%"><input type="text" name="total_insurex/insurex/insurex_remark" label="合计中备注" value="<x:out select="$xmlData/data/total_insurex/insurex/insurex_remark"/>" class="required input_css" style="width: 90px;"/></td>
						</tr>
				</table>
					<br>

					<table width="98%" align="center">
					<tr ><td>
					<input class="button" name="cmdAddbefore" type=button value="添加" onclick="if(checkTabLimit('tblinsurances',30,'投保情况表最多只能填写30条')){addNewRow('tblinsurances');showDateTag('tblinsurances');}try{top.resizeFrame();}catch(e){};">
					<input class="button" name="cmdMovePrev" type=button value="上移" onclick="movePrev('tblinsurances','selinsurances')">
					<input class="button" name="cmdMoveNext" type=button value="下移" onclick="moveNext('tblinsurances','selinsurances')">
					<input class="button" name="cmddel" type=button  value="删除" onclick="deleteSelectedRow('tblinsurances','投保情况表');countTotal('tblinsurances')">
					</td></tr>
	</table>


<script type="text/javascript">
function countTotal(tabId) {
	var total1 = "0";
	var total2 = "0";
	$("#"+tabId+" tr:gt(1)").each(function () {
		var insur_total = $(this).children().eq("5").children().val();
		var insur_total_pay = $(this).children().eq("6").children().val();
		if (!$.isNumeric(insur_total)) insur_total = "0";
		if (!$.isNumeric(insur_total_pay)) insur_total_pay = "0";
		 total1 = ((parseFloat(total1)*10000 + parseFloat(insur_total)*10000)/10000).toFixed(4);
		 total2 = ((parseFloat(total2)*10000 + parseFloat(insur_total_pay)*10000)/10000).toFixed(4);
	});
	
	total1 = formatNumberAuto(total1.toString(), 9, 4, 2);
	total2 = formatNumberAuto(total2.toString(), 9, 4, 2);
	$("#insur_total").val(total1);
	$("#insur_total_pay").val(total2);
}

</script>
